package org.springframework.samples.mvc.basic.tipGotovProizvod;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.mvc.basic.business.AbstractBusinessService;
import org.springframework.samples.mvc.basic.business.Transformer;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.proba.annotations.GenericDAO;
import com.proba.annotations.TipGotovProizvodDAO;
import com.proba.annotations.pojo.TipGotovProizvod;

@Service
public class TipGotovProizvodBusinessServiceImpl extends AbstractBusinessService<TipGotovProizvod, TipGotovProizvodView> implements TipGotovProizvodBusinessService {

	@Autowired
	private TipGotovProizvodDAO dao;
	
	private TipGotovProizvodTransformer transformer = new TipGotovProizvodTransformer();

	@Override
	@Transactional
	public List<TipGotovProizvodView> findAll(int startIndex, int pageSize,
			TipGotovProizvodView queryInfo) {
		List<TipGotovProizvod> res = dao.findByFilterParams(startIndex, pageSize, queryInfo.getId(), queryInfo.getTipGotovProizvod());
		return transform(res);
	}

	@Override
	protected GenericDAO<TipGotovProizvod, Long> getDao() {
		return dao;
	}

	@Override
	protected Transformer<TipGotovProizvod, TipGotovProizvodView> getTransformer() {
		return transformer;
	}

}
